/**
 * Description:
 * Author:han
 * Date: 2024-05-21
 */
public class Ainimal {
    String name;

    public Ainimal() {
        System.out.println("调用父无参构造");
    }

    public Ainimal(String name) {
        System.out.println("调用父有参构造");
        this.name = name;
    }

    public void show() {
        System.out.println("Ainimal是"+ name);
    }

    static class Cat extends Ainimal {
        public Cat() {
            System.out.println("调用子无参构造");
        }

        public Cat(String name) {
            System.out.println("调用子有参构造");
        }
    }

    public static void main(String[] args) {
        Cat cat = new Cat();
        cat.show();
        Ainimal cat1 = new Cat("小猫");
        cat1.show();
    }
}
